package com.study.spark.scala.chapter07

import java.util

import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer

object Scala02_Collection_1{
  def main(args: Array[String]): Unit = {
    // TODO 不可变集合 - 可变数组与不可变数组转换
    // 可变 =>不可变
    val buff = ArrayBuffer(1,2,3)
    val array: Array[Int] = buff.toArray

    // 不可变 =>可变
    val buffer: mutable.Buffer[Int] = array.toBuffer

    // java的集合 <==>Scala的集合
    buff.foreach(println)

    import scala.collection.JavaConverters._
    val list = new util.ArrayList()
    //list.asScala.foreach(println)

    val java: util.List[Int] = List(1,2,3).asJava


  }
}
